package com.greendao;


import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

/**
 * Step 5 - run GreenDao Generator
 * Pick Gradle bookmark from the right side of Android Studio interface. Choose MyDaoGenerator module and click twice on run task.
 * Created by esirong on 2015/9/19.
 */
public class DaoGenerator {
    public static String daoPackage = "com.iman.dao";

    public static void main(String[] args) throws Exception {
        Schema schema = new Schema(1, daoPackage);//the version must >=1;
        addUser(schema);
        addAppInfo(schema);

        new de.greenrobot.daogenerator.DaoGenerator().generateAll(schema, args[0]);
    }

    /**
     * add appLocked TABLE
     * @param schema
     */
    private static void addAppInfo(Schema schema) {
        Entity note = schema.addEntity("AppLocked");
        note.addLongProperty("id").unique();
        note.addStringProperty("label");
        note.addStringProperty("packageName").primaryKey();

    }

    /**
     * add USER TABLE
     * @param schema
     */
    private static void addUser(Schema schema) {
        Entity note = schema.addEntity("User");
        note.addIdProperty();
        note.addIntProperty("lockType");
        note.addStringProperty("passwordDraw");
        note.addStringProperty("passwordPin");
        note.addStringProperty("passwordFace");
        note.addStringProperty("securityAnswer");
        note.addStringProperty("securityQuestion");

    }

}
